CentOS 7安装mysql 8.0.31 (官网rpm方式) 您所在的位置:网站首页 centos 安装mysql80 CentOS 7安装mysql 8.0.31 (官网rpm方式)

CentOS 7安装mysql 8.0.31 (官网rpm方式)

#CentOS 7安装mysql 8.0.31 (官网rpm方式)| 来源: 网络整理| 查看: 265

下载

官网下载地址,选择合适的平台版本,选择Bundle进行下载 在这里插入图片描述 在合适的文件夹下执行wget 命令

wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.31-1.el7.x86_64.rpm-bundle.tar

等待下载完毕 在这里插入图片描述

MySQL RPM Packages介绍 Package NameSummarymysql-community-clientMySQL 客户端应用程序和工具mysql-community-common服务器和客户端库的通用文件mysql-community-devel数据库客户端应用程序的开发头文件和库mysql-community-embedded-compatMySQL 服务器作为嵌入式库,兼容使用库版本18的应用程序mysql-community-libs数据库客户端应用程序的共享库mysql-community-libs-compat以前MySQL安装的共享兼容性库mysql-community-server数据库服务器和相关工具mysql-community-server-debug调试服务器和插件二进制文件mysql-community-test用于 MySQL 服务器的测试套件mysql-community源代码 RPM 看起来类似于 mysql 社区-8.0.31-1.el7.src.rpm,具体取决于所选的操作系统Additional debuginfo RPMs有几个包:mysql-社区-客户端-调试信息,mysql-社区-库-调试信息 mysql-社区-服务器-调试-调试信息 mysql-社区-服务器-调试信息,以及 mysql-社区-测试-调试信息。debuginfo

RPM 的全名具有以下语法:

packagename-version-distribution-arch.rpm MySQL 默认文件路径 文件或资源路径客户端程序和脚本/usr/binmysqld server/usr/sbin配置文件/etc/my.cnf数据data目录/var/lib/mysql错误日志logFor RHEL, Oracle Linux, CentOS or Fedora platforms: /var/log/mysqld.log For SLES: /var/log/mysql/mysqld.logValue of secure_file_priv/var/lib/mysql-files系统初始化脚本For RHEL, Oracle Linux, CentOS or Fedora platforms: /etc/init.d/mysqld For SLES: /etc/init.d/mysqlSystemd serviceFor RHEL, Oracle Linux, CentOS or Fedora platforms: mysqld For SLES: mysqlpid文件/var/run/mysql/mysqld.pidSocket/var/lib/mysql/mysql.sockKeyring directory/var/lib/mysql-keyringUnix manual pages/usr/share/manInclude (header) files/usr/include/mysqlLibraries/usr/lib/mysqlMiscellaneous support files (for example, error messages, and character set files)/usr/share/mysql 开始安装

在大多数情况下,您需要安装 mysql-community-server, mysql-community-client, mysql-community-libs, mysql-community-common, and mysql-community-libs-compat 包才能获得功能正常的标准 MySQL 安装。要执行此类标准的基本安装,请转到包含所有这些包的文件夹(最好是没有其他具有类似名称的 RPM 包),然后发出以下命令:`

解压下载好的文件 tar -xvf mysql-8.0.31-1.el7.x86_64.rpm-bundle.tar sudo yum install mysql-community-{server,client,common,libs}-*

或者

rpm -ivh mysql-community-{server,client,common,libs}-*

虽然使用像 yum 这样的高级包管理工具来安装包要好得多,但喜欢直接 rpm 命令的用户可以用 rpm -Uvh 命令替换 yum 安装命令。但是,使用 rpm -Uvh 会使安装过程更容易出现故障,因为安装过程可能会遇到潜在的依赖关系问题。

依次执行 rpm -ivh mysql-community-common-8.0.31-1.el7.x86_64.rpm rpm -ivh mysql-community-client-plugins-8.0.31-1.el7.x86_64.rpm rpm -ivh mysql-community-libs-8.0.31-1.el7.x86_64.rpm rpm -ivh mysql-community-client-8.0.31-1.el7.x86_64.rpm rpm -ivh mysql-community-icu-data-files-8.0.31-1.el7.x86_64.rpm rpm -ivh mysql-community-server-8.0.31-1.el7.x86_64.rpm 启动mysql systemctl start mysqld 获取首次启动生成的随机密码 sudo grep 'temporary password' /var/log/mysqld.log 登录客户端,输入上一步密码 mysql -uroot -p 更新密码 mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!'; 开启允许root账户远程连接 1.use mysql;//切换使用mysql数据库 2.select user,host from user; //查看用户是否开启远程 3.update user set host='%' where user='root'; //开启远程 4.flush privileges;//刷新权限

在这里插入图片描述

开启防火墙端口允许访问 systemctl status firewalld #查看防火墙状态 firewall-cmd --list-all #查看开放的端口 firewall-cmd --zone=public --add-port=3306/tcp --permanent #添加端口 firewall-cmd --reload #重新加载

在这里插入图片描述 官网文章查考



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

      专题文章
        CopyRight 2018-2019 实验室设备网 版权所有